<!--
* description: TPR单维护
-->
<template>
  <section class="editBigAreaInfo">
    <el-dialog
      v-dialogDrag
      :close-on-click-modal="false"
      title="TPR单维护"
      :append-to-body="true"
      :visible.sync="curPopupsVisible"
      width="70%"
      @close="closeEdit"
    >
      <dialogHeader
        slot="title"
        title="TPR单维护"
        :style-type="$store.state.app.dialogType"
      />
      <!-- 顶部按钮 -->
      <div class="btns-container">
        <div class="btns-cls">
          <el-button
            v-for="item in tableButtons"
            :key="item.comKey"
            :type="item.type"
            @click="item.clickEvent"
          >
            {{ item.text }}
          </el-button>
        </div>
      </div>
      <!-- 保修故障信息反馈 -->
      <div class="filter-container filter-title">保修故障信息反馈</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents1.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
        <div class="filter-title">故障原因判定附件：</div>
        <el-row>
          <OneTableTemplate
            ref="table_1"
            :dynamic-is-show-select="false"
            :dynamic-table-cols="tableHeader_1"
            :is-show-pagination="false"
            :dynamic-table-defult-height="230"
          />
        </el-row>
      </div>
      <!-- TPR单填写 -->
      <div class="filter-container filter-title">TPR单填写</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents2.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>
      <!-- TPR单-问题创建 -->
      <div class="filter-container filter-title">TPR单-问题创建</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents3.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
        <div class="filter-title">QRQA报告附件：</div>
        <el-row>
          <OneTableTemplate
            ref="table_2"
            :dynamic-is-show-select="false"
            :dynamic-table-cols="tableHeader_1"
            :is-show-pagination="false"
            :dynamic-table-defult-height="230"
          />
        </el-row>
      </div>
      <!-- 流出防止 -->
      <div class="filter-container filter-title">流出防止</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents4.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>
      <!-- 初步原因分析 -->
      <div class="filter-container filter-title">初步原因分析</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents5.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
        <div class="filter-title">初步原因附件：</div>
        <el-row>
          <OneTableTemplate
            ref="table_3"
            :dynamic-is-show-select="false"
            :dynamic-table-cols="tableHeader_2"
            :dynamic-buttons="tableButtons1"
            :is-show-pagination="false"
            :dynamic-table-defult-height="230"
          />
        </el-row>
      </div>
      <!-- 临时对策 -->
      <div class="filter-container filter-title">临时对策</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents6.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>
      <!-- 根本原因分析 -->
      <div class="filter-container filter-title">根本原因分析</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents7.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
        <div class="filter-title">根本原因分析附件：</div>
        <el-row>
          <OneTableTemplate
            ref="table_4"
            :dynamic-is-show-select="false"
            :dynamic-table-cols="tableHeader_2"
            :dynamic-buttons="tableButtons2"
            :is-show-pagination="false"
            :dynamic-table-defult-height="230"
          />
        </el-row>
      </div>
      <!-- 永久对策计划、制定 -->
      <div class="filter-container filter-title">永久对策计划、制定</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents8.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
        <div class="filter-title">永久措施附件：</div>
        <el-row>
          <OneTableTemplate
            ref="table_5"
            :dynamic-is-show-select="false"
            :dynamic-table-cols="tableHeader_2"
            :dynamic-buttons="tableButtons3"
            :is-show-pagination="false"
            :dynamic-table-defult-height="230"
          />
        </el-row>
      </div>
      <!-- 永久对策实施 -->
      <div class="filter-container filter-title">永久对策实施</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents9.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
        <div class="filter-title">实施附件：</div>
        <el-row>
          <OneTableTemplate
            ref="table_6"
            :dynamic-is-show-select="false"
            :dynamic-table-cols="tableHeader_2"
            :dynamic-buttons="tableButtons4"
            :is-show-pagination="false"
            :dynamic-table-defult-height="230"
          />
        </el-row>
      </div>
    </el-dialog>
  </section>
</template>
<script>
import { formMixins } from '@/components/mixins/formMixins'
import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins'
import OneTableTemplate from '@/components/templates/oneTable'
// import api from "@/api/se/coreManagement";
import api from '@/api/se/tprManagement'
import request from '@/utils/request'
export default {
  components: {
    dialogHeader: () => import('@/components/dialogHeader'),
    mixButton: () => import('@/components/basicComponent/mixButton'),
    OneTableTemplate
  },

  // 组件混入对象
  mixins: [formMixins, oneTableWithViewTemplateMixins],

  props: {
    // 从网格传入的编辑数据组(json)
    dynamicEditRowData: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },

  data() {
    const viewPageCode = 'bigAreaInfo-edit'
    return {
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: 'btnKey1',
          type: 'primary',
          size: 'small',
          icon: 'iconfont  icon-preservation',
          clickEvent: () => this.callBack(),
          text: '回复' /* 保存*/,
          position: 'right'
        }
      ],
      // 初步原因附件
      tableButtons1: [
        {
          compKey: 'btnKey2',
          type: '',
          size: 'small',
          clickEvent: () => this.handFileListChange(),
          name: 'importTemplate',
          position: 'upload',
          text: '附件上传'
        }
      ],
      // 根本原因附件
      tableButtons2: [
        {
          compKey: 'btnKey3',
          type: '',
          size: 'small',
          // clickEvent: () => this.handFileListChange(),
          name: 'importTemplate',
          position: 'upload',
          text: '附件上传'
        }
      ],
      // 永久对策计划、制定
      tableButtons3: [
        {
          compKey: 'btnKey4',
          type: '',
          size: 'small',
          // clickEvent: () => this.handFileListChange(),
          name: 'importTemplate',
          position: 'upload',
          text: '附件上传'
        }
      ],
      // 永久对策计划、制定
      // tableButtons3: [
      //   {
      //     compKey: 'btnKey5',
      //     type: '',
      //     size: 'small',
      //     // clickEvent: () => this.handFileListChange(),
      //     name: 'importTemplate',
      //     position: 'upload',
      //     text: '附件上传'
      //   }
      // ],
      // 实施附件：
      tableButtons4: [
        {
          compKey: 'btnKey6',
          type: '',
          size: 'small',
          // clickEvent: () => this.handFileListChange(file, fileList, type),
          name: 'importTemplate',
          position: 'upload',
          text: '附件上传'
        }
      ],

      tableComponents1: [
        {
          compKey: 'key0',
          labelName: '保修单号：',
          codeField: 'claimCode',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key1',
          labelName: '供应商代码：',
          codeField: 'supplierCode',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key2',
          labelName: '供应商名：',
          codeField: 'supplierShortName',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key3',
          labelName: '保修类别：',
          codeField: 'guaranteeType',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key4',
          labelName: '车系：',
          codeField: 'carSeries',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key5',
          labelName: '车型：',
          codeField: 'carType',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key6',
          labelName: 'VIN码：',
          codeField: 'vin',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key7',
          labelName: '发动机：',
          codeField: 'engine',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key8',
          labelName: '生产日期：',
          codeField: 'productionDate',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key9',
          labelName: '销售日期：',
          codeField: 'salesDate',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key10',
          labelName: '故障日期：',
          codeField: 'failureDate',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key11',
          labelName: '申请日期：',
          codeField: 'applicationDate',
          component: () => import('@/components/org/commonInput'),
          // component: () => import("@/components/org/commonInput/textareaInput"),
          type: 'dropdownList',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key12',
          labelName: '电机号：',
          codeField: 'electricMachinery',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key13',
          labelName: '行驶里程：',
          codeField: 'mileage',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          // component: () => import("@/components/org/LookupValue"),
          // oFields: "statusId,statusText",
          // options: [
          //   { statusId: "1", statusText: "已发布" },
          //   { statusId: "0", statusText: "已回复" },
          // ],
          // type: "dropdownList",
          isMust: true,
          disabled: true
        },

        {
          compKey: 'key14',
          labelName: '主故障件名称：',
          codeField: 'pfpName',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key15',
          labelName: '主故障件号：',
          codeField: 'pfpCode',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key16',
          labelName: '客户原始描述：',
          codeField: 'customerDescription',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          span: 24,
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key17',
          labelName: '故障条件和现象：',
          codeField: 'faultPhenomenon',
          span: 24,
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key18',
          labelName: '详细检测过程：',
          codeField: 'introductionDescription',
          isMul: false,
          span: 24,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key19',
          labelName: '维修方法简介：',
          codeField: 'repairDescription',
          isMul: false,
          span: 24,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        }
      ],
      tableComponents2: [
        {
          compKey: 'key0',
          labelName: '系统区分：',
          codeField: 'systemDistinction',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true
        },
        {
          compKey: 'key1',
          labelName: '发行TPR：',
          codeField: 'issueTpr',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText'
        },
        {
          compKey: 'key2',
          labelName: '新/再发：',
          codeField: 'isIssue',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key3',
          labelName: '已有问题编号：：',
          codeField: 'questionNumber',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key4',
          labelName: '是否现场调查：',
          codeField: 'isInvestigationCn',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          disabled: true,
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key5',
          labelName: '是否调件：',
          codeField: 'isTransferCn',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key6',
          labelName: '整车档案链接',
          codeField: 'vehicleFiles',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        }
      ],
      tableComponents3: [
        {
          compKey: 'key0',
          labelName: 'TPR单号：',
          codeField: 'tprCode',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key1',
          labelName: '问题状态：',
          codeField: 'problemStatus',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText'
        },
        {
          compKey: 'key2',
          labelName: '创建人：',
          codeField: 'creator',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key3',
          labelName: '创建日期：',
          codeField: 'createdDate',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key4',
          labelName: '问题类别：',
          codeField: 'questionStatusCn',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key5',
          labelName: '问题等级：',
          codeField: 'questionLevel',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key6',
          labelName: '问题性质：',
          codeField: 'questionNature',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key7',
          labelName: '动总配置：',
          codeField: 'powerConfigure',
          disabled: true,
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key8',
          labelName: '累计故障：',
          codeField: 'failuresNum',
          isMul: false,
          disabled: true,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key9',
          labelName: '永久对策导入期限：',
          codeField: 'permanentCountermeasuresDuration',
          disabled: true,
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key10',
          labelName: '责任部门：',
          codeField: 'responsibleDepartment',
          disabled: true,
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key11',
          labelName: '二级责任部门：',
          codeField: 'secondaryResponsibleDepartment',
          disabled: true,
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key12',
          labelName: '责任人 ：',
          disabled: true,
          codeField: 'liabler',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key13',
          labelName: '是否流出防止 ：',
          codeField: 'isLeakage',
          disabled: true,
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        }
        // {
        //   compKey: "key14",
        //   labelName: " QRQA报告附件 ：",
        //   codeField: "vehicleFiles",
        //   disabled: true,
        //   isMul: false,
        //   component: () => import("@/components/org/commonInput"),
        //   type: "inputText",
        //   isMust: true,
        // },
      ],
      tableComponents4: [
        {
          compKey: 'key0',
          labelName: '流程防止措施：',
          codeField: 'preventiveMeasures',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          span: 16,
          isMust: true
        },
        {
          compKey: 'key1',
          labelName: '措施有效性：',
          codeField: 'effectiveness',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText'
        },
        {
          compKey: 'key2',
          labelName: '流出防止开始日：',
          codeField: 'opStartDate',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key3',
          labelName: '流出防止结束日：',
          codeField: 'opEndDate',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key4',
          labelName: '起始VIN：',
          codeField: 'startVin',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key5',
          labelName: '终止VIN：',
          codeField: 'endVin',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        }
      ],
      tableComponents5: [
        {
          compKey: 'key0',
          labelName: '初步原因分析：',
          codeField: 'firstAnalysis',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          span: 24,
          isMust: true
        }
      ],
      tableComponents6: [
        {
          compKey: 'key0',
          labelName: '零时措施：',
          codeField: 'firstAnalysis',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          span: 24,
          isMust: true
        },
        {
          compKey: 'key1',
          labelName: '验证结果：',
          codeField: 'results',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          span: 24,
          isMust: true
        },
        {
          compKey: 'key2',
          labelName: '导入日期：',
          codeField: 'temporaryImportDate',
          isMul: false,
          component: () => import('@/components/org/datePicker/datePicker.vue'),
          type: 'datePicker',
          isMust: true
        }
      ],
      tableComponents7: [
        {
          compKey: 'key0',
          labelName: '根本原因分析：',
          codeField: 'rootAnalysis',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          span: 24,
          isMust: true
        }
      ],
      tableComponents8: [
        {
          compKey: 'key0',
          labelName: '永久措施：',
          codeField: 'measures',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          span: 24,
          isMust: true
        },
        {
          compKey: 'key1',
          labelName: '计划导入日期：',
          codeField: 'plannedImportDate',
          isMul: false,
          component: () => import('@/components/org/datePicker/datePicker.vue'),
          type: 'datePicker',
          isMust: true
        }
      ],
      tableComponents9: [
        {
          compKey: 'key0',
          labelName: '导入日期：',
          codeField: 'permanentImportDate',
          isMul: false,
          component: () => import('@/components/org/datePicker/datePicker.vue'),
          type: 'datePicker',
          isMust: true
        }
      ],
      tableHeader_1: [
        {
          label: '附件名称',
          prop: 'fileName'
        },
        {
          label: '备注',
          prop: 'remark'
        }
      ],
      tableHeader_2: [
        {
          label: '操作',
          prop: 'controlBtn1',
          isComponent: true,
          comps: [
            {
              compKey: 'propKey1',
              labelName: '删除',
              component: () => import('@/components/org/linkButton'),
              clickEvent: (index) => this.deletData(index)
            }
          ]
        },
        {
          label: '附件名称',
          prop: 'fileName'
        },
        {
          label: '备注',
          prop: 'remark',
          isComponent: true,
          comps: [
            {
              compKey: 'compKey5' + this.$utils.generateId(),
              codeField: 'remark',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              rowFileds: 'disabled:discardSetName-是'
            }
          ]
        }
      ],
      // 表单数据（无需赋值，由混入对象赋值）
      formField: this.$utils.getFormField(
        this,
        {
          claimCode: '',
          supplierCode: '',
          supplierShortName: '',
          carSeries: '',
          carType: '',
          vin: '',
          engine: '',
          productionDate: '',
          salesDate: '',
          failureDate: '',
          applicationDate: '',
          electricMachinery: '',
          mileage: '',
          pfpName: '',
          pfpCode: '',
          customerDescription: '',
          faultPhenomenon: '',
          introductionDescription: ''
        },
        this.$ConfigCache.CacheConfig.cacheData[viewPageCode]
      )
    }
  },
  watch: {
    popupsVisible(val, old) {
      if (val) {
        this.findDetail()
      }
    }
  },
  methods: {
    findDetail() {
      request({
        url: api.queryTPRMaintainInfo.APIUrl,
        method: 'post',
        // data: { tprCode: this.dynamicEditRowData.tprCode }
        data: { 
          claimCode: this.dynamicEditRowData.claimCode,
          tprId: this.dynamicEditRowData.tprId
          }
      }).then((res) => {
        if (res.result == '1') {
          this.formField = res.rows[0]
          this.$refs['table_1'].list = this.formField.failureCauseFileList
          this.$refs['table_2'].list = this.formField.QRQAFileList
          this.$refs['table_3'].list = this.formField.firstAnalysisFileList
          this.$refs['table_4'].list = this.formField.rootAnalysisFileList
          this.$refs['table_5'].list = this.formField.plannedFileList
          this.$refs['table_6'].list = this.formField.permanentFileList
        }
      })
    },
    callBack() {
      request({
        url: api.tprReply.APIUrl,
        method: 'post',
        data: this.formField
      }).then((res) => {
        if (res.result == '1') {
          this.$message.success('回复成功')
          this.curPopupsVisible = false
          this.$parent.queryTable(1)
        }
      })
    },
    // 上传附件
    handFileListChange(file, fileList) {
      this.handleChange(file, type)
    },
    handleChange(param, type) {
      debugger
      const that = this
      const url = '/mp/file/commonUpload/upload.do'
      that
        .$requestUpload(url, param)
        .then((response) => {
          if (response.result === '1') {
            //  路径
            const attachmentFilePath = response.path[0][0].split('|')[1]
            // 文件名
            const fileName = response.path[0][0].split('|')[0]
            const dataParmas = { fileName, attachmentFilePath }
            that.addFilePath(dataParmas)
          }
        })
    },
    // 上传附件
    addFilePath(dataParmas) {
      dataParmas.appealId = this.formField.tprId
      dataParmas.fileType = '3'
      request({
        url: api.uploadFile.APIUrl,
        method: 'post',
        data: dataParmas
      }).then((res) => {
        if (res.result == '1') {
          this.$message.success('上传附件成功')
          this.findDetail()
        }
      })
    },
    deletData(index) {
      request({
        url: api.delTprFile.APIUrl,
        method: 'post',
        data: this.$refs['table_3'].list[index]
      }).then((res) => {
        if (res.result == '1') {
          this.$message.success(res.msg)
          this.findDetail()
        }
      })
    },
    closeEdit() {
      this.$emit('close', false)
    }
  }
}
</script>

<style lang="scss" scoped>
.filter-title {
  font-size: 12px !important;
  font-weight: normal !important;
  color: #333
}
.btns-container {
  background-color: #fff;
  overflow: hidden;
  padding-right: 20px;
  .btns-cls {
    float: right;
  }
}
</style>

